my $componentName = "SomethingElse";

main();

sub main {
	print "main\n";
	my $propertySheetId = getPropertySheetId();
	if ($componentName =~ "Conclude" || $componentName =~ "Initiate") {
		gatherBuildMetrics($propertySheetId);
	} else {
		gatherComponentMetrics($propertySheetId);
	}	
}

sub getPropertySheetId {
	return "123456789";
}

sub gatherBuildMetrics {
	# create propertySheet with all Build data
	# name = column title, value = value
	my $propertySheetId = shift;
	setMetric("build metric 1 column title", metricThis(), $propertySheetId);
	setMetric("build metric 2 column title", metricThat(), $propertySheetId);
	pushMetrics($propertySheetId);
}

sub gatherComponentMetrics {
	# create propertySheet with all Component data
	my $propertySheetId = shift;
	setMetric("component metric 1 column title", metricThat(), $propertySheetId);
	setMetric("component metric 2 column title", metricOther(), $propertySheetId);
	pushMetrics($propertySheetId);
}

sub setMetric {
	my $name = shift;
	my $value = shift;
	my $propertySheetId = shift;
	
	print "setProperty($name, value=$value, propertySheetId=$propertySheetId)\n";
}

sub pushMetrics {
	my $propertySheetId = shift;
	# call procedure in MasterRIM_ABRL_Interface to construct an
	# sql insert command, prepare it, and execute it
	print "invokeCommander runProcedure MasterRIM_ABRL_Interface procedureName=pushMetrics actualParameter propertySheetId=$propertySheetId\n";
}

sub metricThis {
	return "metricThis";
}

sub metricThat {
	return "metricThat";
}

sub metricOther {
	return "metricOther";
}
